﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MockupDesigner.AppItems.Commands
{
    public class CutCommand : ICommand
    {

        public CommandType CommandType
        {
            get { return CommandType.Undoable; }
        }

        private DesignerCanvas designerCanvas;
        private DeleteCommand deleteCommand = new DeleteCommand();
        private CopyCommand copyCommand = new CopyCommand();

        public void Execute(object target, params object[] parameters)
        {
            if (!(target is DesignerCanvas))
            {
                throw new InvalidCastException("The target must be a DesignerCanvas");
            }
            this.designerCanvas = (DesignerCanvas)target;

            Redo();
        }

        public void Redo()
        {
            copyCommand.Execute(this.designerCanvas, null);
            deleteCommand.Execute(this.designerCanvas, null);
        }

        public void Undo()
        {
            deleteCommand.Undo();
        }

    }
}
